# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Rasmus Thomsen <oss@cogitri.dev>
pkgname=gcr
pkgver=3.36.0
pkgrel=0
pkgdesc="A library for bits of crypto UI and parsing"
url="https://wiki.gnome.org/Projects/CryptoGlue"
arch="all"
license="LGPL-2.0-or-later"
makedepends="glib-dev gtk+3.0-dev libgcrypt-dev p11-kit-dev
	gobject-introspection-dev libxslt vala meson gtk-doc"
checkdepends="xvfb-run dbus-x11"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang $pkgname-base"
source="https://download.gnome.org/sources/gcr/${pkgver%.*}/gcr-$pkgver.tar.xz
	allow-building-without-gpg.patch
	dont-run-gpg-tests.patch"
options="!check"  # Some tests are broken, see issue #11327.

build() {
	meson \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--buildtype=plain \
		-Dgpg_path=/usr/bin/gpg2 \
		output
	ninja -C output
}

check() {
	xvfb-run ninja -C output test
}

package() {
	DESTDIR="$pkgdir" ninja -C output install
}

base() {
	depends=""
	pkgdesc="$pkgdesc (base libraries)"
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/libgck-1.so.* \
		"$pkgdir"/usr/lib/libgcr-base-3.so.* \
		"$subpkgdir"/usr/lib
}

sha512sums="0431e7971b73accc62869c9497fcff7c111c453aa6a8ff25b42f19ceae1be0aec52e0e4eb504676f967c6e4f179198c15c521278690822e3457dbc5fe512fd5e  gcr-3.36.0.tar.xz
7cca3fd0512621129f0a0c532a3592b4ea0e49f887cf5935b1a104363d08fca05dbba470672561efa4b8b02efdbe22c948f989af26fdb32833a82383393207f0  allow-building-without-gpg.patch
e4fc2248497e7103980e9baf9444505649ee93c657c7a82c042ae62d7c54b2764ad7bc9780467ceda5e53a23fa11dc4957898929c7d7f995d9d0d205d18d5eb7  dont-run-gpg-tests.patch"
